package com.ruoyi.modules.service.impl;

import com.ruoyi.common.core.domain.entity.Face;
import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.modules.mapper.FaceMapper;
import com.ruoyi.modules.service.FaceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FaceServiceImpl implements FaceService
{
    @Autowired
    private FaceMapper faceMapper;

    /**
     * 根据条件分页查询人脸数据
     */
    @Override
    public List<Face> selectFaceList(Face Face)
    {
        return faceMapper.selectFaceList(Face);
    }


    /**
     * 根据人脸数据ID查询信息
     */
    @Override
    public Face selectFaceById(Long FaceId)
    {
        return faceMapper.selectFaceById(FaceId);
    }

    @Override
    public Face selectFaceByUserIdAndNewCreateTime(Long userId) {
        return faceMapper.selectFaceByUserIdAndNewCreateTime(userId);
    }

    /**
     * 批量删除人脸数据信息
     */
    @Override
    public int deleteFaceByIds(Long[] FaceIds)
    {
        int row = faceMapper.deleteFaceByIds(FaceIds);
        if (row > 0)
        {
            DictUtils.clearDictCache();
        }
        return row;
    }

    /**
     * 新增保存人脸数据信息
     */
    @Override
    public int insertFace(Face Face)
    {
        int row = faceMapper.insertFace(Face);
        if (row > 0)
        {
            DictUtils.clearDictCache();
        }
        return row;
    }

    /**
     * 修改保存人脸数据信息
     */
    @Override
    public int updateFace(Face face)
    {
        int row = faceMapper.updateFace(face);
        if (row > 0)
        {
            DictUtils.clearDictCache();
        }
        return row;
    }


}

